package com.example.opengldemo.jbulletJava;


import com.example.opengldemo.util.MatrixState;
import com.example.opengldemo.util.ShapeFactory;

import java.nio.FloatBuffer;

public class SimpleShaderBuffer {

    FloatBuffer vertexBuffer ;
    FloatBuffer texcoorBuffer ;
    FloatBuffer normalBuffer ;
    FloatBuffer colorBuffer ;
    public int vCount ;

    FloatBuffer vertexBuffer2 ;
    FloatBuffer vertexBuffer3 ;

    FloatBuffer colorBuffer2 ;

    public SimpleShaderBuffer(){
    }
    public void setTexcoorBuffer(float[] array) {
        if(array == null || array.length == 0) return ;
        this.texcoorBuffer = ShapeFactory.getFloatBuffer(array);
    }
    public void setVertexBuffer(float[] array) {
        if(array == null || array.length == 0) return ;
        this.vertexBuffer = ShapeFactory.getFloatBuffer(array);
        vCount = array.length / 3 ;
    }
    public void setVertexBuffer2(float[] array) {
        if(array == null || array.length == 0) return ;
        this.vertexBuffer2 = ShapeFactory.getFloatBuffer(array);

    }
    public void setVertexBuffer3(float[] array) {
        if(array == null || array.length == 0) return ;
        this.vertexBuffer3 = ShapeFactory.getFloatBuffer(array);

    }
    public void setNormalBuffer(float[] array) {
        if(array == null || array.length == 0) return ;
        this.normalBuffer = ShapeFactory.getFloatBuffer(array);
    }
    public void setColorBuffer(float[] array) {
        if(array == null || array.length == 0) return ;
        this.colorBuffer = ShapeFactory.getFloatBuffer(array);
    }

    public void setColorBuffer2(float[] array) {
        if(array == null || array.length == 0) return ;
        this.colorBuffer2 = ShapeFactory.getFloatBuffer(array);
    }

    public void setVertexBuffer(FloatBuffer vertexBuffer) {
        this.vertexBuffer = vertexBuffer;
    }

    public void setTexcoorBuffer(FloatBuffer texcoorBuffer) {
        this.texcoorBuffer = texcoorBuffer;
    }

    public void setNormalBuffer(FloatBuffer normalBuffer) {
        this.normalBuffer = normalBuffer;
    }

    public void setColorBuffer(FloatBuffer colorBuffer) {
        this.colorBuffer = colorBuffer;
    }

    public void setvCount(int vCount) {
        this.vCount = vCount;
    }

    public FloatBuffer getVertexBuffer() {
        return vertexBuffer;
    }
    public FloatBuffer getVertexBuffer2() {
        return vertexBuffer2;
    }
    public FloatBuffer getVertexBuffer3() {
        return vertexBuffer3;
    }

    public FloatBuffer getNormalBuffer() {
        return normalBuffer;
    }

    public FloatBuffer getTexcoorBuffer() {
        return texcoorBuffer;
    }

    public FloatBuffer getColorBuffer(){
        return colorBuffer ;
    }
    public FloatBuffer getColorBuffer2(){
        return colorBuffer2 ;
    }


    public FloatBuffer getCameraBuffer(){
        return MatrixState.cameraLocationFB ;
    }
    public FloatBuffer getLightLocationBuffer(){
        return MatrixState.lightLocationFB ;
    }
    public float[] getMVPMatrixArray(){return MatrixState.getFinalMatrix();}
    public float[] getMMatrixArray(){return MatrixState.getMMatrix() ;}
}
